package cn.njxzc.exercises;

class A {
	int lea = 12;
	double x = 13.5;

}

public class ProMethod {

	/**
	 * @Enclosing_Method : hundredChickens
	 * @Written by : Roy Xu
	 * @Creation Date : 2016年3月15日 上午12:36:42
	 * @version : v1.00
	 * @Description :
	 */
	private void hundredChickens() {
		for (int x = 1; x < 34; x++)
			for (int y = 1; y < 21; y++)
				if (3 * x + 5 * y + (100 - x - y) / 3 == 100
						&& (100 - x - y) % 3 == 0)
					System.out.println("公鸡=" + x + ",母鸡" + y + ",小鸡="
							+ (100 - x - y));

	}

	/**
	 * MethodName : prime
	 * 
	 * @param:
	 * @return:
	 * @throws: Written by :roy xu Creation Date : 2016/3/17 0017 Time:18:33
	 *          version : Description
	 */
	public void prime(int nstart, int nend) {

		int n;
		n = 0;
		nstart = 101;
		nend = nstart + 104;
		boolean prime = false;
		if (nstart < nend) {
			for (int i = nstart; i < nend; i += 2) {
				prime = true;
				for (int j = 2; j < i; j++) {
					// 判断2~i之间的数有没有能被i整除
					if (i % j == 0) {
						prime = false;
						break;
					}
				}
				if (prime) {
					System.out.print(i + " ");
					n++;
				}
				if (n % 8 == 0)
					System.out.println();

			}

		} else {
			System.out.println("nstart 必须小于 nend");
		}

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ProMethod pm = new ProMethod();
		A a = new A();
		System.out.println(a.lea);

		pm.prime(101, 200);
		pm.hundredChickens();

	}

}
